home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11026 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1019 b   |  39 lines

  1. Path: mother.usf.edu!news
  2. From: Chris Frenck <cfrenck@soleil.acomp.usf.edu>
  3. Newsgroups: comp.lang.c
  4. Subject: simple struct error check question
  5. Date: Thu, 21 Mar 1996 10:50:03 -0500
  6. Organization: University of South Florida
  7. Message-ID: <31517AAB.77C0@soleil.acomp.usf.edu>
  8. NNTP-Posting-Host: ppp141.cfr.usf.edu
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (Win95; I)
  13.  
  14. This is a simple structure program I am writing and am wondering how to 
  15. error check the input size of the members. Here is the pertinent code 
  16. information. Any help would be great!
  17.  
  18. struct Dbase 
  19.     { char fname[NMAX];
  20.       char lname[NMAX];
  21.       char address[AMAX];
  22.       char phone[PMAX];
  23.     };
  24. main()
  25. .
  26. .
  27.  
  28. void add(struct Dbase *dbase) **add subroutine**
  29. . misc lines of code
  30. .
  31. printf("\nFull Name in (first last) format=> ");
  32. scanf(" %s %s", dbase->fname, dbase->lname);
  33.  
  34. How can I ensure that fname and lname do not exceed their max size?
  35.  
  36. TIA
  37. Chris Frenck
  38. cfrenck@soleil.acomp.usf.edu
  39.